import request from '@/utils/request'

export function getList() {
  return request({
    url: '/menu',
    method: 'get'
  })
}

export function getInfo(id) {
  return request({
    url: `/menu/${id}`,
    method: 'get'
  })
}

export function add(data) {
  return request({
    url: '/menu',
    method: 'post',
    data
  })
}

export function edit(data) {
  return request({
    url: '/menu',
    method: 'put',
    data
  })
}

export function getMainList() {
  return request({
    url: '/menu/list',
    method: 'get'
  })
}

export function getChildList(id) {
  return request({
    url: `/menu/list/${id}`,
    method: 'get'
  })
}

export function getTree(id) {
  return request({
    url: `/menu/treeList/${id}`,
    method: 'get'
  })
}
